package com.cake.liulanxiangzhu.web;

public enum ProductCode {
    YES(1, "是"),
    NO(0, "否");

    private Integer code;
    private String msg;

    ProductCode(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }


    public Integer getCode() {
        return this.code;
    }

    public String getMessage() {
        return this.msg;
    }


    public boolean equals(String code) {
        if (this.code.equals(Integer.parseInt(code))) {
            return true;
        } else {
            return false;
        }
    }

    public boolean equals(Integer code) {
        if (this.code == code) {
            return true;
        } else {
            return false;
        }
    }

    public static String getDesc(Integer code) {
        ProductCode[] values = ProductCode.values();
        for (ProductCode value : values) {
            if (value.getCode().equals(code)) {
                return value.getMessage();
            }
        }
        return "";
    }
}
